package com.cbts.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
/**
 * UserGroup entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "user_group", catalog = "cbts", uniqueConstraints = @UniqueConstraint(columnNames = "userGroupName"))
public class UserGroup implements java.io.Serializable {

	// Fields

	private Integer userGroupId;
	private TravelStandard travelStandard;
	private String userGroupName;
	private Set<UserInfo> userInfos = new HashSet<UserInfo>(0);

	// Constructors

	/** default constructor */
	public UserGroup() {
	}

	/** minimal constructor */
	public UserGroup(Integer userGroupId, String userGroupName) {
		this.userGroupId = userGroupId;
		this.userGroupName = userGroupName;
	}

	/** full constructor */
	public UserGroup(Integer userGroupId, TravelStandard travelStandard,
			String userGroupName, Set<UserInfo> userInfos) {
		this.userGroupId = userGroupId;
		this.travelStandard = travelStandard;
		this.userGroupName = userGroupName;
		this.userInfos = userInfos;
	}

	// Property accessors
	@Id
	@Column(name = "userGroupId", unique = true, nullable = false)
	@GeneratedValue(strategy = GenerationType.IDENTITY) 
	public Integer getUserGroupId() {
		return this.userGroupId;
	}

	public void setUserGroupId(Integer userGroupId) {
		this.userGroupId = userGroupId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "standardId")
	public TravelStandard getTravelStandard() {
		return this.travelStandard;
	}

	public void setTravelStandard(TravelStandard travelStandard) {
		this.travelStandard = travelStandard;
	}

	@Column(name = "userGroupName", unique = true, nullable = false, length = 45)
	public String getUserGroupName() {
		return this.userGroupName;
	}

	public void setUserGroupName(String userGroupName) {
		this.userGroupName = userGroupName;
	}

	@OneToMany( fetch = FetchType.LAZY, mappedBy = "userGroup")
	public Set<UserInfo> getUserInfos() {
		return this.userInfos;
	}

	public void setUserInfos(Set<UserInfo> userInfos) {
		this.userInfos = userInfos;
	}

}